package com.zoe.config;

import com.zoe.bean.Person;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Controller;

//配置类注解
@Configuration
@ComponentScan(value = {"com.zoe"},
    excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class})}
//    useDefaultFilters = false
)
// value : 扫描该包下面所有被Spring注解标注的类
// excludeFilters : 排除指定规则下面的组件
// includeFilters : 加入指定规则下面的组件  需要配合 useDefaultFilters 来设置默认不扫描所有包

//@ComponentScans(value = {
//    @ComponentScan(value = {"com.zoe"},
//        excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class})}
//        //    useDefaultFilters = false
//    )
//})
// ComponentScans里面可以配置多个@ComponentScan,可以实现多个扫描规则
public class MainConfig {
    //    给容器注册一个bean,id默认用方法名作为bean的id
    @Bean(value = "person")
    public Person person01() {
        return new Person(12, "配置注解");
    }
}
